﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace IndieStudio.BugsBang.Game
{
	public class TargetScore : MonoBehaviour {

		/// <summary>
		/// The value of the score.
		/// </summary>
		[HideInInspector]
		private int value;

		/// <summary>
		/// The max value of the score.
		/// </summary>
		private int maxValue;

		/// <summary>
		/// The cover of the target score.
		/// </summary>
		public Image cover;

		/// <summary>
		/// The text score of the target.
		/// </summary>
		public Text scoreText;

		// Use this for initialization
		void Start () {
		}

		/// <summary>
		/// Set the score text.
		/// </summary>
		public void SetScoreText(){
			scoreText.text = value + "/" + maxValue;
		}

		/// <summary>
		/// Increase the value of the score.
		/// </summary>
		public void IncrementValue(){
			this.value++;
			SetScoreText ();
		}

		/// <summary>
		/// Get the value of the score.
		/// </summary>
		/// <returns>The value of the score.</returns>
		public int GetValue(){
			return this.value;
		}

		/// <summary>
		/// Set the max value of the score.
		/// </summary>
		/// <param name="maxValue">Max value of the score.</param>
		public void SetMaxValue(int maxValue){
			this.maxValue = maxValue;
			SetScoreText ();
		}

		/// <summary>
		/// Get the max value of the score.
		/// </summary>
		/// <returns>The max value.</returns>
		public int GetMaxValue(){
			return this.maxValue;
		}

		/// <summary>
		/// Determines whether the final score is reached or not.
		/// </summary>
		/// <returns><c>true</c> if this instance is full; otherwise, <c>false</c>.</returns>
		public bool IsFull(){
			return value == maxValue;
		}
	}
}
